PER.rover
Class API

java.lang.Object
  extended byPER.rover.API

public class API
extends java.lang.Object

API class


Constructor Summary
API()
          Class constructor.
 
Method Summary
 boolean Blacklight(boolean enabled)
          Turns on or off the blacklight.
 boolean ColorTrack(java.awt.Color myColor, float deviation)
          Track the given color by moving the head pan/tilt and using method "0".
 boolean ColorTrack(java.awt.Color myColor, float deviation, int method, boolean movePan, boolean moveTilt)
          Track the given color by moving the head pan/tilt and using method "0".
 boolean ColorTrack(int minY, int maxY, int minU, int maxU, int minV, int maxV)
          Track the given color (int YUV space) by moving the head pan/tilt and using method "0".
 boolean ColorTrack(int minY, int maxY, int minU, int maxU, int minV, int maxV, int method, boolean movePan, boolean moveTilt)
          Track the given color (int YUV space) by moving the head pan/tilt and using method "0".
 boolean Drive(int cm, int angle)
          Moves forward cm centimeters unless obstructed by an obstacle.
 java.awt.image.BufferedImage GetPanorama(TakePanoramaAction myAction, boolean waitForIt)
          Gets the BufferedImage taken by the action myAction.
 void initialize(Rover rov)
          Sets this instance of API to use the Rover rov.
 boolean Kill()
          Abort whatever the rover is currently doing.
 boolean LookAt(int pan, int tilt)
          Sets the rover's head to the given pan and tilt.
static void main(java.lang.String[] args)
          test main function which turns on the blacklight
 boolean PanoramaFinished(TakePanoramaAction myAction)
          Returns true if myAction has finished executing.
 void Println(java.lang.String output)
          Just like regular println, prints a string to the console.
 TakePanoramaAction StartPanorama(int lowAng, int highAng, int width, int height)
          Causes the rover to take a panoramic image, resetting the head position to 0,0
 java.awt.image.BufferedImage TakePicture(int pan, int tilt, int width, int height, boolean UV)
          Causes the rover to take a single image.
 boolean TurnTo(int deg)
          Rotates the rover by deg degrees about its center, in a counterclockwise direction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

API

public API()
Class constructor.

Method Detail

initialize

public void initialize(Rover rov)
Sets this instance of API to use the Rover rov.

Parameters:
rov - A Rover object with which the API can talk to the PER.

TakePicture

public java.awt.image.BufferedImage TakePicture(int pan,
                                                int tilt,
                                                int width,
                                                int height,
                                                boolean UV)
Causes the rover to take a single image.

Parameters:
pan - The pan value in degrees at which to take the picture
tilt - The tilt vale in degrees at which to take the picture
width - The width of the image in pixels
height - The hiehgt of the image in pixels
UV - True if the UV light should be on for the picture, false otherwise
Returns:
A new BufferedImage upon success.

Upon failure returns null

See Also:
BufferedImage

StartPanorama

public TakePanoramaAction StartPanorama(int lowAng,
                                        int highAng,
                                        int width,
                                        int height)
Causes the rover to take a panoramic image, resetting the head position to 0,0

Parameters:
lowAng - The minimum tilt angle that the picture includes
highAng - The maximum tilt angle that the picture includes
width - The width in pixels of the target image
height - The height in pixels of the target image
Returns:
A running TakePanoramaAction which may then be passed to PanoramaFinished or GetPanoramaImage, null on failure

PanoramaFinished

public boolean PanoramaFinished(TakePanoramaAction myAction)
Returns true if myAction has finished executing. Should only be called after StartPanorama.

Parameters:
myAction - A TakePanoramaAction created via a call to StartPanorama
Returns:
true if the action is finished, false if it is still running.

GetPanorama

public java.awt.image.BufferedImage GetPanorama(TakePanoramaAction myAction,
                                                boolean waitForIt)
Gets the BufferedImage taken by the action myAction.

Parameters:
myAction - A TakePanoramaAction created via a call to StartPanorama
waitForIt - if true, the thread will block until the action is done, or we've waited 30 seconds
Returns:
The panoramic image taken by myAction.

Returns null if myAction failed, if myAction is not completed and waitForIt is false, or if myAction has timed out while waiting for it to complete.

See Also:
BufferedImage

LookAt

public boolean LookAt(int pan,
                      int tilt)
Sets the rover's head to the given pan and tilt.

Parameters:
pan - The pan value in degrees at which to take the picture
tilt - The tilt vale in degrees at which to take the picture
Returns:
false on error or if pan or tilt are out of a valid range

TurnTo

public boolean TurnTo(int deg)
Rotates the rover by deg degrees about its center, in a counterclockwise direction.

Parameters:
deg - Distance to turn in degrees
Returns:
false on error

Drive

public boolean Drive(int cm,
                     int angle)
Moves forward cm centimeters unless obstructed by an obstacle.

Parameters:
cm - Distance to travel in centimeters
angle - Angle in degrees counterclockwise from current heading to turn before driving
Returns:
false on error

Blacklight

public boolean Blacklight(boolean enabled)
Turns on or off the blacklight.

Parameters:
enabled - Set to true to turn on the blacklight, false to turn it off
Returns:
false on error

Println

public void Println(java.lang.String output)
Just like regular println, prints a string to the console.

Parameters:
output - The string to print

Kill

public boolean Kill()
Abort whatever the rover is currently doing.

Returns:
false on error

ColorTrack

public boolean ColorTrack(java.awt.Color myColor,
                          float deviation)
Track the given color by moving the head pan/tilt and using method "0".

Parameters:
myColor - The color to track
deviation - the percentage deviation from the given color's values to track
Returns:
false on error
See Also:
note: should there be a seperate deviation for each color?

ColorTrack

public boolean ColorTrack(java.awt.Color myColor,
                          float deviation,
                          int method,
                          boolean movePan,
                          boolean moveTilt)
Track the given color by moving the head pan/tilt and using method "0".

Parameters:
myColor - The color to track
deviation - the percentage deviation from the given color's values to track
method - method used for color tracking, enumerate later
movePan - Track color by allowing head Pan movement
moveTilt - Track color by allowing head Tilt movement
Returns:
false on error
See Also:
note: should there be a seperate deviation for each color?

ColorTrack

public boolean ColorTrack(int minY,
                          int maxY,
                          int minU,
                          int maxU,
                          int minV,
                          int maxV)
Track the given color (int YUV space) by moving the head pan/tilt and using method "0".

Parameters:
minY - The minimum Y value of the color to track
maxY - The maximum Y value of the color to track
minU - The minimum U value of the color to track
maxU - The maximum U value of the color to track
minV - The minimum V value of the color to track
maxV - The maximum V value of the color to track
Returns:
false on error

ColorTrack

public boolean ColorTrack(int minY,
                          int maxY,
                          int minU,
                          int maxU,
                          int minV,
                          int maxV,
                          int method,
                          boolean movePan,
                          boolean moveTilt)
Track the given color (int YUV space) by moving the head pan/tilt and using method "0".

Parameters:
minY - The minimum Y value of the color to track
maxY - The maximum Y value of the color to track
minU - The minimum U value of the color to track
maxU - The maximum U value of the color to track
minV - The minimum V value of the color to track
maxV - The maximum V value of the color to track
method - method used for color tracking, enumerate later
movePan - Track color by allowing head Pan movement
moveTilt - Track color by allowing head Tilt movement
Returns:
false on error

main

public static void main(java.lang.String[] args)
test main function which turns on the blacklight

Parameters:
args - Not used